<?php $this->load->view('header') ?>

<div id="content">
<div class="column full fl">
		
		<div class="box">
		<div class="box-header">Daftar Pasien Baru</div>
		<div class="box-content box-table">
		<br />
		
        	<?php if (isset($errorMessage)) : ?>
            	<div class="notification <?php echo ((isset($isSuccess) && $isSuccess) ? 'success' : 'error');?>"><?php echo $errorMessage; ?></div>
	        <?php endif; ?>    	
	        <br />
	        
	        <?php  echo form_open('klinik/reportReg/regBaru', array('name'=>'formPasienBaru','id'=>'formPasienBaru','class'=>'frModalLoad'),array('kirim'=>'kirim')); ?>
		        &nbsp;&nbsp;&nbsp;&nbsp;  
		        Tanggal &nbsp;&nbsp;&nbsp; 
		        <?php echo form_input(array('name'=>'frdate','value'=>$uri_to_assoc['frdate'] == 'all' ? '' : $uri_to_assoc['frdate'], 'class'=> 'form-field date', 'readonly'=>'readonly', 'style'=>'width:80px'));?>
		        - 
		        <?php echo form_input(array('name'=>'todate','value'=>$uri_to_assoc['todate'] == 'all' ? '' : $uri_to_assoc['todate'], 'class'=> 'form-field date', 'readonly'=>'readonly', 'style'=>'width:80px'));?>

 				&nbsp;&nbsp;
		        <?php echo form_submit('submit','Cari', 'class="button themed"');?>

				<?php if($uri_to_assoc['frdate'] != 'all' || $uri_to_assoc['todate'] != 'all'):?>
		        	<?php echo anchor('klinik/reportReg/regBaru', '<b>Clear Date</b>' , 'style="color:red"')?>
		        <?php endif;?>
		        		        
			<?php echo form_close();?>
	        <br />
	        
            <?php echo $paging?>
            <table class="tablebox">
            <thead class="table-header" style="border-top:1px solid #ccc;border-bottom:1px solid #ccc">
                <tr>
                	<th width="10">No</th>
                	<th>Tanggal</th>
                    <th>Waktu</th>
                    <th>Nama</th>
                    <th>Jenkel</th>
                    <th>Usia</th>
                    <th>No Telp</th>
                    <th>Jml</th>
                    <th width="200">Action</th>
                </tr>
            </thead>
            <tbody>
            	<?php $totalPayment = 0;?>
            	
            	<?php $no = get_data($uri_to_assoc,'page') + 1;?>
                <?php if ($dataView) foreach($dataView as $key=>$row) : ?>
                <?php $class = $no % 2 == 0 ? 'even' : 'odd' ?>
                <tr class=<?php echo $class?>>
                	<td><?php echo $no?></td>
                	
                	<!-- Date -->
                	<?php if($key > 0):?>
                		<td><?php echo mydate($dataView[$key-1]['pasienLastRJ']) == mydate($row['pasienLastRJ']) ? '' : mydate($row['pasienLastRJ'])?></td>
                	<?php else:?>
                    	<td><?php echo mydate($row['pasienLastRJ'])?></td>
                    <?php endif;?>
                    
                    <td><?php echo mytime($row['pasienLastRJ']);?></td>
                    
                    <td><?php echo get_data($row,'pasienNama')?></td>
                    <td><?php echo get_data($row,'pasienJenKel')?></td>
                    <td><?php echo getUsia(get_data($row,'pasienTglLahir'))?></td>
                    <td><?php echo get_data($row,'pasienNoTelp')?></td>
                    <td><?php echo get_data($row,'pasienJmlRJ') > 0 ? get_data($row,'pasienJmlRJ').' Kali' : '-';?></td>
                    <td>
                        <?php //echo isAccess('klinik','pasien','rekammedis') ? anchor('klinik/pasien/rekamMedis/from/regBaru/pasienId/'.$row['pasienId'],'<span class="icon_text preview"></span>RM', 'class="button white"', 'class="button white"') : ''?>
                        <?php echo isAccess('klinik','pasien','detail') ? anchor('klinik/pasien/detail/from/regBaru/pasienId/'.$row['pasienId'],'Detail', 'class="button white"', 'class="button white"') : ''?>
                    </td>
                </tr>
                <?php $no++?>
                <?php endforeach;?>
            </tbody>
            
            <?php if( $dataView ):?>
            <tfoot>
	            <tr class='<?php echo ($no+1) % 2 == 0 ? 'even' : 'odd' ?>' style='font-weight:bold;'>
            		<td></td><td></td><td></td><td></td>
            		<td></td><td></td><td></td><td></td>
            		<td>
            			<?php echo isAccess ( 'klinik', 'reportreg', 'printbaru') ? anchor('klinik/reportReg/printBaru/frdate/'.get_data($uri_to_assoc,'frdate').'/todate/'.get_data($uri_to_assoc,'todate'), '<span class="icon_text pdf"></span>Export Data', 'class="button white" target="_blank"') : '';?>    
            		</td>
	            </tr>
            </tfoot>
            <?php endif;?>
            
            </table>
            <div id="paging">
            <?php echo $paging?>
            </div>
		</div>
		</div>
	
	</div>

<script type="text/javascript">
<!--
jQuery(document).ready(function($){
	//Date
	$('.date').datepicker({
	   yearRange: "-10:+10",
	   dateFormat: 'yy-mm-dd',
	   maxDate: 'd', 
	   showButtonPanel: true,
	   changeMonth: true,
	   changeYear: true
	});
});
//-->
</script> 
<?php $this->load->view('footer') ?>